package com.eascs.web.o2o.report.util;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * @description 读取Properties文件
 * @File ReadFileProperties.java
 * @author CXW
 * @Date: 2016-05-13 02:52:40
 */
public class ReadFileProperties {
	private static String filepath;
	private static String host;
	private static String toemail;
	private static String fromemail;
	private static String fromemailpd;
	private static String emailtitle;
	private static String emailtext;

	public static void innitdate() {
		Properties prop = new Properties();
		// InputStream in =
		// ReadFileProperties.class.getResourceAsStream("/send_email_bank_report.properties");
		try {
			InputStreamReader in = new InputStreamReader(ReadFileProperties.class.getResourceAsStream("/send_email_bank_report.properties"), "UTF-8");
			prop.load(in);
			filepath = prop.getProperty("filepath").trim();
			host = prop.getProperty("host").trim();
			toemail = prop.getProperty("toemail").trim();
			fromemail = prop.getProperty("fromemail").trim();
			fromemailpd = prop.getProperty("fromemailpd").trim();
			emailtitle = prop.getProperty("emailtitle").trim();
			emailtext = prop.getProperty("emailtext").trim();
			emailtitle = prop.getProperty("emailtitle").trim();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 私有构造方法，不需要创建对象
	 */
	private ReadFileProperties() {
	}

	public static String getFilepath() {
		return filepath;
	}

	public static String getHost() {
		return host;
	}

	public static String getToemail() {
		return toemail;
	}

	public static String getFromemail() {
		return fromemail;
	}

	public static String getFromemailpd() {
		return fromemailpd;
	}

	public static String getEmailtitle() {
		return emailtitle;
	}

	public static String getEmailtext() {
		return emailtext;
	}

	public static void main(String args[]) {
		innitdate();
		System.out.println(ReadFileProperties.getFilepath());
		System.out.println(ReadFileProperties.getHost());
		System.out.println(ReadFileProperties.getEmailtext());
	}
}
